package com.henu.rescue.service.impl;

import com.henu.rescue.entity.Accident;
import com.henu.rescue.entity.Order;
import com.henu.rescue.entity.VO.OrderVO;
import com.henu.rescue.mapper.OrderMapper;
import com.henu.rescue.service.OrderService;
import com.henu.rescue.utils.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;


    @Override
    public Integer initOrder(Order order) {
        return orderMapper.initOrder(order);
    }

    @Override
    public Page<OrderVO> selectOrderInfoByPage(Page<OrderVO> page) {
        List<OrderVO> orderList = orderMapper.selectOrdeInfoByPage(page);
        page.setList(orderList);
        //查询总数
        int totalCount =orderMapper.getCountByPage(page);
        page.setTotalCount(totalCount);
        return page;
    }

    @Override
    public Integer delByLogic(String orderId) {
        return orderMapper.delLogicById(orderId);
    }

    @Override
    public Integer updateStatus(String orderId, Integer status) {
        return orderMapper.updateStatus(orderId,status);
    }

    @Override
    public Integer selectById(String orderId) {
        return orderMapper.selectById(orderId);
    }

    @Override
    public Order getOrderById(String orderId) {
        return orderMapper.getOrderByID(orderId);
    }

    @Override
    public  Integer updateOrder(Order order) {
        return orderMapper.updateOrder(order);
    }

    @Override
    public Integer getOrderCount() {
        return orderMapper.getOrderCount();
    }


}
